SELECT T.*,
  ROW_NUMBER() OVER(ORDER BY PROJECT_DICTIONARY.CODE, T_SITE.CODE, T.CODE) RN ,
  T_SITE.CODE             AS SITE_CODE ,
  T_SITE.NAME             AS SITE_NAME,
  PROJECT_DICTIONARY.CODE AS PROJECT_CODE ,
  PROJECT_DICTIONARY.NAME AS PROJECT_NAME,
  TYPE_DICTIONARY.CODE    AS TYPE_CODE ,
  TYPE_DICTIONARY.NAME    AS TYPE_NAME
FROM C1_PERMISSION T
LEFT JOIN C1_SITE T_SITE
ON (T_SITE.ID = T.SITE_ID)
LEFT JOIN C1_DICTIONARY PROJECT_DICTIONARY
ON (PROJECT_DICTIONARY.ID = T_SITE.PROJECT_ID)
LEFT JOIN C1_DICTIONARY TYPE_DICTIONARY
ON (TYPE_DICTIONARY.ID = T.TYPE_ID)
WHERE T.id = :id